import React from 'react';
import ReactDOM from 'react-dom';
class ListOfWords extends React.PureComponent{
	render() {
		return (
			<div>{this.props.words.join(',')}</div>
		)
	}
}

export default class WordAdder extends React.Component{
	constructor(props) {
		super(props);
		this.state={words: ['maker']};
		this.handleClick=this.handleClick.bind(this);
	}
	handleClick() {
		this.state.words.push('maker');
		this.setState({words: [...this.state.words]});
	}
	render() {
		return (
			<div>
				<button onClick={this.handleClick} />
				<ListOfWords words={this.state.words}/>
			</div>
		)
	}
}